package com.xinyu.entity;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

@Component("user")
//	@Service("user")
//	@Controller("user")
//	@Repository("user")
@Scope(scopeName="prototype")
public class User {
	private String name;
	@Value("23")
	private String age;
	
//	@Autowired
//	@Qualifier("car")
	@Resource(name="car")
	private Car car;
	
	public String getName() {
		return name;
	}
	@Value("小王")
	public void setName(String name) {
		this.name = name;
	}
	public String getAge() {
		return age;
	}
	public void setAge(String age) {
		this.age = age;
	}
	@PostConstruct
	public void init() {
		System.out.println("我是初始化方法");
	}
	@PreDestroy
	public void destory() {
		System.out.println("我是销毁方法");
	}
}
